import Mock from "mockjs";

let wenzhang = Mock.mock({
    "data|17":[
        {
            title:"@ctitle(5,7)",
            miao:"@csentence(25,28)",
            color:"@color",
            name:"@cname",
            time: "2021-12-25",
            id: new Date().getTime(),
            "pic":"@image"
        }
    ]
});

class Mockapi {
    getServerList(current_page: number, page_size: number) {
        const newList = wenzhang.data.slice(
          (current_page - 1) * page_size,
          (current_page - 1) * page_size + page_size
        );
        return Promise.resolve({
            status:0,
            result:newList
        })
}
getwenzhen() {
    return Promise.resolve({
        status:0,
        result:wenzhang
    })
}

  removeItem(id: number) {
    wenzhang = wenzhang.filter((item:any) => {
      return item.id !== id;
    });
    return Promise.resolve({
      status: 0,
      msg: "删除成功",
    });
  }
  
}

export const mockapi = new Mockapi();